//初始化统计图的展示形式及数据,生成图和表
function createTableAndChart(action) {
	var showPercent = false;
	initLeftMemu();
	var data = getUrlData();
	var msg = getData(data, action);
	var seriesData = ""; //按series的格式{name:name,data:data}接收数据，最终转成json格式
	var seriesName = "";
	var valid = msg.valid;
	var xTitle = "Time(M)";
	if (valid[0].year != valid[valid.length - 1].year && valid.length <= 3) {
		showPercent = true;
	}
	for ( var i = 0; i < valid.length; i++) {
		for ( var n = 0; n < valid[i].data.length; n++) {
			seriesData += "{name:'" + valid[i].year + " " + (valid[i].data[n].type.length == 1 ? valid[i].data[n].type + valid[i].tx : valid[i].tx + " " + valid[i].data[n].type)
					+ "',data:[" + addNullData(valid[i].data[n].data) + "]},";

		}
	}
	var xAxisCategories = "['Jan','Feb','Mar','Apr','May','Jun','July','Aug','Sep','Oct','Nov','Dec']";
	seriesData = seriesData.substr(0, seriesData.length - 1);
	createTheme();
	var options = createOptionsSeriesType('container',data.type);
	options.xAxis.categories = eval("(" + xAxisCategories + ")");//将读取到的数据转成json数组格式
	options.series = eval("[" + seriesData + "]");//将图例数据部分转成json数组格式
	options.xAxis.title.text = xTitle;
	options.yAxis.title.text = valid[0].tx+" No.";
	options.title.text = replaceWithChar(data.title, "_", " "); //" Number Stat. By Month";

	createAnnualContrastTable(options.xAxis.categories, options.series, showPercent,valid,'dataAnnualContrastDiv');
	$("<br>").insertAfter($('#dataAnnualContrastDiv'));
	createInValidTable(msg.invalid,'invalidTableDiv');
	createChart(options);
}
createTableAndChart('getChart2_2_0_4');